const path = require('path')
const merge = require('webpack-merge')
const HtmlWebPackPlugin = require('html-webpack-plugin')
const baseWebpackConfig = require('./webpack.config.base')
const webpack = require('webpack')



const devWebpackConfig = merge(baseWebpackConfig, {
  devServer: {
    clientLogLevel: 'warning',
    contentBase: path.resolve(__dirname, './dist'),
    hot: true, 
    host: 'localhost',
    port: 8080
  },
  plugins: [
    new webpack.HotModuleReplacementPlugin(),
    new HtmlWebPackPlugin({
      // filename: 'index.html',
      template: 'index.html',
      inject: true
    })
  ]
})



module.exports = new Promise((resolve, reject) => {
  console.log('export', devWebpackConfig)
  resolve(devWebpackConfig)
})

// module.exports = {
//   devServer: {
//     contentBase: path.join(__dirname, 'dist'),
//     compress: true,
//     port: 9000
//   }
// }